﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace PSE.Communication.Fix.Common
{
    public class FixSessionConfigurationElement : BaseConfigurationElement
    {
        [ConfigurationProperty("brokerage", IsRequired = true)]
        public int Brokerage
        {
            get { return int.Parse(this["brokerage"].ToString()); }
        }

        [ConfigurationProperty("password", IsRequired = true)]
        public string Password
        {
            get { return (string)this["password"]; }
        }

        [ConfigurationProperty("newPassword", IsRequired = false)]
        public string NewPassword
        {
            get { return (string)this["newPassword"]; }
        }

        [ConfigurationProperty("defaultPassword", IsRequired = false)]
        public string DefaultPassword
        {
            get { return (string)this["defaultPassword"]; }
        }

        [ConfigurationProperty("resetAll", IsRequired = false)]
        public bool ResetAll
        {
            get { return (bool)this["resetAll"]; }
        }

        [ConfigurationProperty("fileLogPath", IsRequired = true)]
        public string FileLogPath
        {
            get { return FixConfigurationManager.GetFullPath((string)this["fileLogPath"]); }
        }

        [ConfigurationProperty("beginString", IsRequired = true)]
        public string BeginString
        {
            get { return (string)this["beginString"]; }
        }

        [ConfigurationProperty("connectionType", IsRequired = true)]
        public string ConnectionType
        {
            get { return (string)this["connectionType"]; }
        }

        [ConfigurationProperty("senderCompID", IsRequired = true)]
        public string SenderCompID
        {
            get { return (string)this["senderCompID"]; }
        }

        [ConfigurationProperty("targetCompID", IsRequired = true)]
        public string TargetCompID
        {
            get { return (string)this["targetCompID"]; }
        }

        [ConfigurationProperty("fileStorePath", IsRequired = true)]
        public string FileStorePath
        {
            get { return FixConfigurationManager.GetFullPath((string)this["fileStorePath"]); }
        }

        [ConfigurationProperty("socketConnectHost", IsRequired = true)]
        public string SocketConnectHost
        {
            get { return (string)this["socketConnectHost"]; }
        }

        [ConfigurationProperty("socketConnectPort", IsRequired = true)]
        public int SocketConnectPort
        {
            get { return (int)this["socketConnectPort"]; }
        }

        [ConfigurationProperty("startTime", IsRequired = true)]
        public string StartTime
        {
            get { return (string)this["startTime"]; }
        }

        [ConfigurationProperty("endTime", IsRequired = true)]
        public string EndTime
        {
            get { return (string)this["endTime"]; }
        }

        [ConfigurationProperty("heartBtInt", IsRequired = true)]
        public int HeartBtInt
        {
            get { return (int)this["heartBtInt"]; }
        }

        [ConfigurationProperty("resetOnLogon", IsRequired = true)]
        public string ResetOnLogon
        {
            get { return (string)this["resetOnLogon"]; }
        }

        [ConfigurationProperty("validateUserDefinedFields", IsRequired = true)]
        public string ValidateUserDefinedFields
        {
            get { return (string)this["validateUserDefinedFields"]; }
        }

        [ConfigurationProperty("period", IsRequired = true)]
        public int Period
        {
            get { return (int)this["period"]; }
        }
    }
}